import { http,upload } from '@/utils/http';
import type { UserInfo,Gender } from '@/type/user'
//获取token
export const API_getToken = (data: {code:string}) => {
  return http<string>({
    method: 'GET',
      url: `/user/weChatLogin`,
      data
  })
}
// 获取用户信息
export const API_getUserInfo = () => {
  return http<UserInfo>({
    method: 'GET',
    url: '/user/userInfo',
  })
}

//编辑资料
export const API_saveUserMsg = (nickname:string,gender:Gender) => {
    return http<string>({
    method: 'PUT',
    url: `/user/editProfile?nickname=${nickname}&gender=${gender}`,
  })
}

//上传头像
export const API_uploadAvatar = (fileSrc:string) => {
    return upload<string>({
    url: '/user/uploadAvatar',
    name: 'file',
    filePath: fileSrc,
  })
}
